package anroid.vstore.provider;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * @author Gabriele Porcelli
 * 
 *         Example. 
 *         FirstTimePreference prefFirstTime = new FirstTimePreference(getApplicationContext()); 
 *         if (prefFirstTime.runTheFirstNTimes("myKey" , 3)) {
 *         Toast.makeText(this,"Test myKey & coutdown: "+ prefFirstTime.getCountDown("myKey"),Toast.LENGTH_LONG).show(); }
 */

public class SharedPreference {

	private static final int INT_ERROR = -1;
	public static final String FIRST_TIME_PREFERENCES_KEY = "FirstKeyPreferences";
	
	
	public static final String LastestDate = "LastestDate";
	private final SharedPreferences firstTimePreferences;

	public SharedPreference(Context context) {
		firstTimePreferences = context.getSharedPreferences(
				FIRST_TIME_PREFERENCES_KEY, Context.MODE_PRIVATE);
	}
	public String getLastestDate()
	{
		return firstTimePreferences.getString(LastestDate, "");
	}
	public void setLastestDate(String date)
	{
		SharedPreferences.Editor editor = firstTimePreferences.edit();
		editor.putString(LastestDate, date);
		editor.commit();
	}
	
}
